how to stop event bubbling in javascript
how to stop event bubbling in javascript
1392
13-May-2018
Updated on 07-Jun-2018
Prakash nidhi Verma
07-Jun-2018All handlers on the path reached on window of the events. A bubbling event goes from the target element is correctly and straight. this happens start first from <HTML>. any of the handlers may to decide for process or stopped a bubbling events.
The method is shown below :
another method handlers are move but bubbling will be stopped.
code for stopping Bubbling:
if (event.stopPropagation) {event.stopPropagation();
} else {
event.cancelBubble = true;
}
or through on click events:
<body onclick="alert('bubbling is not here')"><button onclick="event.stopPropagation()">Go</button>
</body>
I hope, It will be helpful for You.
You can find more information by my recent post on Bubbling .
Link: https://mindstick.com/forum/34485/javascript-event
Happy Coding :)
Manish Kumar
14-May-2018Event handling is the receipt of an event at some event handler from an event producer and subsequent processes. The processes involved in event handling include: Identifying where an event should be forwarded. Making the forward.
Event bubbling is a type of event propagation where the event first triggers on the innermost target element and then successively triggers on the ancestors (parents) of the target element in the same nesting hierarchy till it reaches the outermost DOM element or document object (Provided the handler is initialized).